package com.warrior.entity;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by shawn on 2017/4/25.
 */
@Entity
@Table(name = "admin_user", schema = "warrior")
public class AdminUser {
    private String id;//记录管理人员的id,AD-UUID表示
    private String userName;//记录管理人员用户名字段
    private String password;//记录管理人员的密码,用md5基础加密
    private Integer userType;//记录管理人员类型
    private String mobile;//记录管理人员的手机号
    private Timestamp lastLoginTime;//记录管理员上次登录时间
    private Timestamp createdAt;//记录该条记录的创建时间
    private Timestamp updateAt;//记录该条记录的更新时间
    private String createdBy;//记录该条记录的创建者
    private String updateBy;//记录该条记录由何人更新
    private Integer userStatus;//用户状态 1正常

    @Id
    @Column(name = "id")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "user_name")
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Basic
    @Column(name = "password")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "user_type")
    public Integer getUserType() {
        return userType;
    }

    public void setUserType(Integer userType) {
        this.userType = userType;
    }

    @Basic
    @Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    @Basic
    @Column(name = "last_login_time")
    public Timestamp getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Timestamp lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    @Basic
    @Column(name = "created_at")
    public Timestamp getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Timestamp createdAt) {
        this.createdAt = createdAt;
    }

    @Basic
    @Column(name = "update_at")
    public Timestamp getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(Timestamp updateAt) {
        this.updateAt = updateAt;
    }

    @Basic
    @Column(name = "created_by")
    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    @Basic
    @Column(name = "update_by")
    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AdminUser adminUser = (AdminUser) o;

        if (id != null ? !id.equals(adminUser.id) : adminUser.id != null) return false;
        if (userName != null ? !userName.equals(adminUser.userName) : adminUser.userName != null) return false;
        if (password != null ? !password.equals(adminUser.password) : adminUser.password != null) return false;
        if (userType != null ? !userType.equals(adminUser.userType) : adminUser.userType != null) return false;
        if (mobile != null ? !mobile.equals(adminUser.mobile) : adminUser.mobile != null) return false;
        if (lastLoginTime != null ? !lastLoginTime.equals(adminUser.lastLoginTime) : adminUser.lastLoginTime != null)
            return false;
        if (createdAt != null ? !createdAt.equals(adminUser.createdAt) : adminUser.createdAt != null) return false;
        if (updateAt != null ? !updateAt.equals(adminUser.updateAt) : adminUser.updateAt != null) return false;
        if (createdBy != null ? !createdBy.equals(adminUser.createdBy) : adminUser.createdBy != null) return false;
        if (updateBy != null ? !updateBy.equals(adminUser.updateBy) : adminUser.updateBy != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (userName != null ? userName.hashCode() : 0);
        result = 31 * result + (password != null ? password.hashCode() : 0);
        result = 31 * result + (userType != null ? userType.hashCode() : 0);
        result = 31 * result + (mobile != null ? mobile.hashCode() : 0);
        result = 31 * result + (lastLoginTime != null ? lastLoginTime.hashCode() : 0);
        result = 31 * result + (createdAt != null ? createdAt.hashCode() : 0);
        result = 31 * result + (updateAt != null ? updateAt.hashCode() : 0);
        result = 31 * result + (createdBy != null ? createdBy.hashCode() : 0);
        result = 31 * result + (updateBy != null ? updateBy.hashCode() : 0);
        return result;
    }

    @Basic
    @Column(name = "user_status")
    public Integer getUserStatus() {
        return userStatus;
    }

    public void setUserStatus(Integer userStatus) {
        this.userStatus = userStatus;
    }
}
